package language;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
	public static final String[]	languajes				= { "es", "en" };

	public static final String		BUNDLE_NAME_AR	= "language.MessagesBundle_es_AR";	//$NON-NLS-1$
	public static final String		BUNDLE_NAME_US	= "language.MessagesBundle_en_US";	//$NON-NLS-1$

	private static String					BUNDLE_NAME			= "language.MessagesBundle_en_US";	//$NON-NLS-1$

	private static ResourceBundle	RESOURCE_BUNDLE	= ResourceBundle
																										.getBundle(BUNDLE_NAME);

	private Messages() {
	}

	public static void setBundleName(String language)
	{
		BUNDLE_NAME = language;
		RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
	}
	
	public static String getBundleName()
	{
		return BUNDLE_NAME;
	}

	public static String getString(String key)
	{
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
